CC=gcc
CXX=g++
CFLAGS=-Wall $(DEBUG) $(DEFINITIONS) $(CINCLUDES) $(CMISCFLAGS) $(CE)
CPPFLAGS=-Wall $(DEBUG) $(CPPINCLUDES) $(DEFINITIONS) $(CPPMISCFLAGS) $(CE)
DEBUG=-O0 -g3
CMISCFLAGS=
CPPMISCFLAGS=
DEFINITIONS=-DLINUX_OS
CINCLUDES=-I. -I$(GDIR)/utils
CPPINCLUDES=-I. -I$(GDIR)/utils

GDIR=../../../..
LD=g++
LDFLAGS=
LIBS=-lrt -lpthread -lGL -lGLU -lglut
SRCSC=$(GDIR)/utils/ownutils.c
SRCSCPP=pickTest3d.cpp \
picking.cpp \
objects.cpp \
controls.cpp \
glutils.cpp


## Construct final lists of CPP and C objects
OBJS_C=$(SRCSC:.c=.o)
OBJS_CPP=$(SRCSCPP:.cpp=.opp)

## Define compiles and links
COMPILEC=$(CC) $(CFLAGS) $(CINCLUDES) -c
COMPILECPP=$(CXX) $(CPPFLAGS) $(CPPINCLUDES) -c
LINK=$(LD) $(LDFLAGS) $(LIBS)

.PHONY: all clean

all: pickTest3d

pickTest3d: $(OBJS_C) $(OBJS_CPP)
	@$(LINK) -o $@ $(OBJS_C) $(OBJS_CPP)
	@echo "      [LD] $@"

clean:
	rm -f $(OBJS_C) $(OBJS_CPP) pickTest3d *.out *~ *.d *.dpp

## Below this is dependency generation stuff, no need to change.
## Compile rule for all .o (.c) file
%.o:    %.c
	@$(COMPILEC) -o $@ $<
	@echo "      [CC] $<"

## Compile rule for all .opp (.cpp) files
%.opp:  %.cpp
	@$(COMPILECPP) -o $@ $<
	@echo "      [CXX] $<"
